<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form id="student-edit-form" action="StudentServlet.do?method=update"
		method="post">
		 <input type="hidden" name="id">
		<div class="datagrid-body">
			<table class="datagrid-btable" cellspacing="0" cellpadding="0"
				border="0" style="width: 100%;">
				<tbody>
		<tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">姓名</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
							<input type="text" name="name"
							class="easyui-validatebox" style="width: 266px">
						</td>
					</tr>
					<tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">身份证号</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
							<input type="text" name="idNumber"
							class="easyui-validatebox" style="width: 266px">
						</td>
					</tr>
					<tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">性别</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
							<div>
							<input name="sex" type="radio" checked="checked"  value='男'>男
                      		<input name="sex" type="radio"  value='女'>女
                      		</div> 
						</td>
					</tr>
					<tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">年龄</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
							<input type="text" name="age"
							class="easyui-validatebox" style="width: 266px">
						</td>
					</tr>
					 <tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">手机号</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
							<input type="text" name="phone"
							class="easyui-validatebox" style="width: 266px">
						</td>
					</tr>
					<tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">报考车型</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
					        <select name="candiCar" style="width: 80px">
					        	<option value="C1">C1</option>
					        	<option value="C2">C2</option>
					        	<option value="B1">B1</option>
					        	<option value="B2">B2</option>
					        	<option value="A1">A1</option>
					        	<option value="A2">A2</option>
					        </select>
						</td>
					</tr>
					<tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">学费</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
							<input type="text" name="learnSalary"
							class="easyui-validatebox" style="width: 266px">
						</td>
					</tr>
					<tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">户籍</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
							<input type="text" name="censusRegister"
							class="easyui-validatebox" style="width: 266px">
						</td>
					</tr>
					<tr class="datagrid-row">
						<td
							style="border-style: solid; width: 15%; text-align: right; padding-right: 7px">住址</td>
						<td style="border-style: solid; width: 35%; text-align: left;">
							<input type="text" name="address"
							class="easyui-validatebox" style="width: 266px">
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</form>
	<script type="text/javascript">
function getQueryParam(name) {
     var obj = $('#common-dialog').dialog('options');
     var queryParams = obj["queryParams"];
     return queryParams[name];
}
//自动填充值
function autoInput(obj){
 	$.each(obj, function(i, n){
	  //from 下的input
	  //$("#student-edit-form input[name='"+i+"']").val(n);
	  var $var = $("#student-edit-form input[name='"+i+"']");
	  if($var.attr("type")=="text" ||$var.attr("type")=="hidden"){
		  $var.val(n);
	  }else if($var.attr("type")=="radio"){
		  //男  女
		  $var.filter("input[value='"+n+"']").attr("checked",true); 
	  }
	  if(i=="candiCar"){
		  //男  女
		  $("#student-edit-form select[name='"+i+"']").val(n);
	  }
	  
	});
}
$(function(){
	var _id  =getQueryParam("id");
	$.getJSON("StudentServlet.do?method=edit",{id:_id},function(json){
			//自动添值
		  autoInput(json);
	});
	$("#student-edit-form .easyui-validatebox").validatebox({
        required:true,
        novalidate:true
    }).focus(function(){
        $(this).validatebox({novalidate:false});
    }).blur(function(){
    	$(this).validatebox({novalidate:false});
});
});
</script>
</body>
</html>
